<template>
  <div class="header">
    <el-row type="flex" justify="space-between" class="main">
      <div class="logo">
        <img src="../assets/logo1.png" alt="" />
      </div>
      <el-row ref="router" type="flex" class="nav">
        <router-link to="/index" @click.native="openFullScreen1"
          >首页</router-link
        >
        <router-link to="/index/agents" @click.native="openFullScreen1"
          >房产经纪</router-link
        >
        <router-link to="/index/propertyClass" @click.native="openFullScreen1"
          >地产分类</router-link
        >
        <router-link
          :to="`/index/aboutus/${item.id}`"
          @click.native="openFullScreen1"
          v-for="item in aboutUsList"
          :key="item.id"
          >{{ item.title }}</router-link
        >
      </el-row>
    </el-row>
    <hr />
  </div>
</template>

<script>
import { getPages } from "@/api/pages.js";
export default {
  data() {
    return {
      fullscreenLoading: false,
      aboutUsList: [],
    };
  },
  methods: {
    openFullScreen1() {
      this.fullscreenLoading = true;
      setTimeout(() => {
        this.fullscreenLoading = false;
      }, 400);
    },
    async getPages() {
      const { data } = await getPages({
        _limit: 3,
        _start: 0,
        title_contains: "",
      });
      this.aboutUsList = data;
    },
  },
  created() {
    this.getPages();
  },
};
</script>

<style lang="less" scoped>
.header {
  height: 60px;
  hr {
    margin: 0;
  }

  .logo {
    height: 100%;
    width: 150px;
    text-align: right;
    img {
      height: 100%;
    }
  }

  /deep/ .nav {
    margin-left: 100px;
    overflow: hidden;
    flex: 1;
    .el-menu.el-menu--horizontal {
      border-bottom: 0;
    }
    a {
      display: block;
      text-align: center;
      line-height: 60px;
      padding: 0 20px;
      color: #000;
      text-decoration: none;
      font-size: 16px;
    }
    .router-link-exact-active.router-link-active {
      background: #489df9;
      border-bottom: 0;
    }
  }
}
</style>